package com.huarui.initial.action;

import java.io.InputStream;

import org.apache.struts2.ServletActionContext;
import org.ewaf.framework.action.BaseAction;

import com.opensymphony.xwork2.Action;

@SuppressWarnings("serial")
public class InitialDownLoadAction extends BaseAction {
	public static final String fileName="initialTemplate.xls";
	public static final String toolsFileName="tools.rar";

    //从下载文件原始存放路径读取得到文件输出流
    public InputStream getDownloadFile() {
        return ServletActionContext.getServletContext().getResourceAsStream("/htdocs/html/"+fileName);
    }
    //如果下载文件名为中文，进行字符编码转换
    public String getDownloadChineseFileName() {
        String downloadChineseFileName = fileName;
   /*     try {
            downloadChineseFileName = new String(downloadChineseFileName.getBytes(), "ISO-8859-1");
        } catch (UnsupportedEncodingException e) {

        	e.printStackTrace();
            
        }*/

        return downloadChineseFileName;
    }
    
    public  String getToolsFileName() {
		return toolsFileName;
	}
	public InputStream getToolsDownloadFile() {
        return ServletActionContext.getServletContext().getResourceAsStream("/htdocs/html/"+toolsFileName);
    }
	public String down(){
		return Action.SUCCESS;
	}
	
	public String toolsDownload(){
		return Action.SUCCESS;
	}
}
